libname out 'c:\bill\crack\results_revision\acs_09_11';
filename ASCIIDAT "c:\bill\crack\results_revision\acs_09_11\usa_00084.dat";

data one;
infile ASCIIDAT pad missover lrecl=95;

input
  YEAR       1-4
  DATANUM    5-6
  SERIAL     7-14
  HHWT       15-24 .2
  STATEFIP   25-26
  METAREA    27-29
  METAREAD   30-33
  GQ         34-34
  PERNUM     35-38
  PERWT      39-48 .2
  AGE        49-51
  SEX        52-52
  MARST      53-53
  BIRTHYR    54-57
  RACE       58-58
  RACED      59-61
  BPL        62-64
  BPLD       65-69
  HISPAN     70-70
  HISPAND    71-73
  EDUC       74-75
  EDUCD      76-78
  EMPSTAT    79-79
  EMPSTATD   80-81
  LABFORCE   82-82
  INCTOT     83-89
  INCWAGE    90-95
;

label
  YEAR     = "Census year"
  DATANUM  = "Data set number"
  SERIAL   = "Household serial number"
  HHWT     = "Household weight"
  STATEFIP = "State (FIPS code)"
  METAREA  = "Metropolitan area [general version]"
  METAREAD = "Metropolitan area [detailed version]"
  GQ       = "Group quarters status"
  PERNUM   = "Person number in sample unit"
  PERWT    = "Person weight"
  AGE      = "Age"
  SEX      = "Sex"
  MARST    = "Marital status"
  BIRTHYR  = "Year of birth"
  RACE     = "Race [general version]"
  RACED    = "Race [detailed version]"
  BPL      = "Birthplace [general version]"
  BPLD     = "Birthplace [detailed version]"
  HISPAN   = "Hispanic origin [general version]"
  HISPAND  = "Hispanic origin [detailed version]"
  EDUC     = "Educational attainment [general version]"
  EDUCD    = "Educational attainment [detailed version]"
  EMPSTAT  = "Employment status [general version]"
  EMPSTATD = "Employment status [detailed version]"
  LABFORCE = "Labor force status"
  INCTOT   = "Total personal income"
  INCWAGE  = "Wage and salary income"
;


data two;
set one;
if race<=2;     * keep black and white;
if hispan=0;    * delete hispanics;
if 1<=bpl<=56;  * keep people born in the US;
yearturn18=birthyr+18;   * year turn 18;
if 1965<=yearturn18<=2007;  * keep those who turn 18 from 73 to 99;
hsgrad=educd>=62;

proc sort data=two;
by race yearturn18;
proc means data=two noprint;
by race yearturn18;
var hsgrad;
weight perwt;
output out=byrace mean=hsgrad;
proc print data=byrace;
var race yearturn18 hsgrad;
run;

proc sort data=two;
by sex race yearturn18;
proc means data=two noprint;
by sex race yearturn18;
var hsgrad;
output out=bysexrace mean=hsgrad;
weight perwt;
run;
